package playgame;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import javax.swing.Timer;

/**
 * Extends MovingGameObject and Implements the ActionListener
 * 
 * @author Bomberman Crew 20(C)09
 * 
 */
public class Bomb extends MovingGameObject implements ActionListener {
	int power;
	int x;
	int y;
	int type;
	boolean on;
	Timer time;
	int explodeTime = 2000;
	Player owner;
	
	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	/**
	 * The Bomb constructor takes one parameter and creates a Timer.
	 * The timer "removes" the bomb from the Level after a given time.
	 * @param image - a BufferedImage
	 */
	public Bomb(BufferedImage image) {
		super(image);
		on = true;
		time = new Timer(explodeTime, (ActionListener) this);
		time.setRepeats(false);
		time.start();
	}
	
	public void setPower(Player player){
		power = player.getPower();
	}


	public void setOwner(Player player){
		owner = player;
	}
	
	public void actionPerformed(ActionEvent e) {
		on = false;
		
	}

	
	public boolean getStatus(){
		return on;
	}
	
	public Player getOwner(){
		return owner;
	}
	
}
